<template name="courseParameter">
	<view>
		<view class="parameterBox">
			<!-- <text class="parameterTitle">课程参数</text> -->
			<view class="parameterList">
				<text class="tabHead">参数属性</text>

				<view class="row">
					<text class="ptKey">适用年龄</text>
					<text class="ptValue">{{goodParameter.age=='-1'?'不限':goodParameter.age}}</text>
				</view>
				<view class="row">
					<text class="ptKey">班级类型</text>
					<text class="ptValue">{{goodParameter.userNum>1?'集体班':'一对一'}}</text>
				</view>
				<view class="row" v-if="goodParameter.userNum>0">
					<text class="ptKey">班级人数</text>
					<text class="ptValue">{{goodParameter.userNum}}</text>
				</view>
				<view class="row">
					<text class="ptKey">上课类型</text>
					<text class="ptValue">{{typeArr[goodParameter.type]}}</text>
				</view>
				<view class="row" v-if="goodParameter.type==1||goodParameter.type==3">
					<text class="ptKey">周期时长</text>
					<text class="ptValue">{{goodParameter.period}}天</text>
				</view>
				<view class="row" v-if="goodParameter.type==2||goodParameter.type==3">
					<text class="ptKey">课次总数</text>
					<text class="ptValue">{{goodParameter.count}}次</text>
				</view>
				<view class="row" v-if="(goodParameter.type==2||goodParameter.type==3) && goodParameter.time">
					<text class="ptKey">每次时长</text>
					<text class="ptValue">{{shichang=='0秒'?"":shichang}}</text>
				</view>
				<view class="row">
					<text class="ptKey">是否支持体验</text>
					<text class="ptValue">{{goodParameter.tri==1?'支持':'不支持'}}</text>
				</view>
				<!-- <view class="row">
					<text class="ptKey">开课时间</text>
					<text class="ptValue">{{goodParameter.startTime}}</text>
				</view> -->
				<!-- <view class="moreBtn" @tap="toggleShow">
					<text>{{isFull?'收起':'展开'}}</text>
					<text :class="['iconfont',isFull?'icon-fold':'icon-unfold']"></text>
				</view> -->
			</view>
		</view>
	</view>

</template>

<script>
	import COMM from "@/common/common.js";
	export default {
		name: 'courseParameter', //组件名称
		// 传递参数
		props: {
			goodParameter: {
				type: Object,
				default: ()=>{
					return {}
				}
			}
			
		},
		// 组件参数
		data() {
			return {
				isFull: true,
				typeArr: ['', '周期', '课次', '周期+课次'],
				shichang:''
			}
		},
		// 组件方法
		methods: {
			toggleShow() {
				if (this.isFull) {

					this.isFull = false;
				} else {

					this.isFull = true;
				}
			},
			getShichang(){
				this.shichang=COMM.getTm(this.goodParameter.time);
			}
		},
		
		created() {
			setTimeout(()=>{
				this.getShichang();
			},500)
		}
	}
</script>

<style lang="less" scoped>


	.parameterBox {
		display: flex;
		flex-direction: column;
		background-color: #FFFFFF;
		padding: 18upx 28upx;

		.parameterTitle {
			font-size: 32rpx;
			font-weight: bold;
			color: #202932;
		}
		.parameterList {
			display: flex;
			flex-direction: column;
			border: 1px solid #cfcfcf;
			border-bottom: none;
			margin-top: 26upx;

			.row {
				display: flex;
				border-bottom: 1px solid #cfcfcf;
				min-height: 42rpx;
				line-height: 42upx;

				text {
					font-size: 24rpx;
					color: #202932;
				}

				.ptKey {
					border-right: 1px solid #cfcfcf;
					width: 35%;
					text-align: center;
					flex-shrink: 0;
				}

				.ptValue {
					padding-left: 20upx;
				}
			}
		}

		.tabHead {
			height: 42rpx;
			background-color: #e7e7e7;
			font-size: 24rpx;
			color: #222222;
			line-height: 42upx;
			padding: 0 12upx;
			border-bottom: 1px solid #cfcfcf;
			font-weight: bold;
		}

		.moreBtn {
			height: 42upx;
			display: flex;
			justify-content: center;
			align-items: center;

			text {
				font-size: 24rpx;
				color: #202932;
			}

			.iconfont {
				margin-left: 10upx;
			}
		}
	}
</style>
